package org.jeecg.entity.meter;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.enums.car.ChargeStatusEnum;
import org.jeecg.enums.InvoiceTypeEnum;
import org.jeecg.enums.PayModeEnum;
import org.jeecg.enums.PayStatusEnum;
import org.jeecg.enums.common.PayTypeEnum;
import org.jeecg.enums.meter.MeterInvoiceStatusEnum;
import org.jeecg.enums.meter.RefundStatusEnum;
import org.jeecg.modules.system.entity.BaseEntity;
import org.jeecg.vo.meter.MeterSwitchRespVo;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * @Description: 仪器充值订单表
 * @Author: liurui
 * @Date:   2020-11-27
 * @Version: V1.0
 */
@Data
@TableName("meter_order")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="meter_order对象", description="仪器充值订单表")
public class MeterOrder extends BaseEntity  {

	@ApiModelProperty(value = "充值状态(0:充值中 1:充值成功 9:充值失败)")
	@TableField(exist = false)
	private Integer chargeStatus;

	@Excel(name = "充值状态", width = 15)
	@TableField(exist = false)
	private String chargeStatusStr;

	/**创建者*/
	@Excel(name = "创建者", width = 15)
	@ApiModelProperty(value = "创建者")
	private String createBy;
	/**创建时间*/
	@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "创建时间")
	private Date createTime;

	/**id*/
	@TableId(type = IdType.UUID)
	@ApiModelProperty(value = "id")
	private String id;
	/**开票账号*/
	@Excel(name = "开票账号", width = 15)
	@ApiModelProperty(value = "开票账号")
	private String invoiceAccount;
	/**开票地址*/
	@Excel(name = "开票地址", width = 15)
	@ApiModelProperty(value = "开票地址")
	private String invoiceAddress;
	/**开票税号*/
	@Excel(name = "开票税号", width = 15)
	@ApiModelProperty(value = "开票税号")
	private String invoiceEin;
	/**开票邮箱*/
	@Excel(name = "开票邮箱", width = 15)
	@ApiModelProperty(value = "开票邮箱")
	private String invoiceEmail;
	/**开票手机号*/
	@Excel(name = "开票手机号", width = 15)
	@ApiModelProperty(value = "开票手机号")
	private String invoiceMobile;
	/**开票人*/
	@Excel(name = "开票人", width = 15)
	@ApiModelProperty(value = "开票人")
	private String invoiceName;
	/**发票号*/
	@Excel(name = "发票号", width = 15)
	@ApiModelProperty(value = "发票号")
	private String invoiceNo;
	/**开票状态*/
	@Excel(name = "开票状态", width = 15)
	@ApiModelProperty(value = "开票状态（1：不开票  2：线下票据  3：电子发票）")
	private Integer invoiceStatus;
	/**开票时间*/
	@Excel(name = "开票时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "开票时间")
	private Date invoiceTime;
	@ApiModelProperty(value = "开票类型 (0:个人  1：企业)")
	private Integer invoiceType;

	@Excel(name = "开票类型 ", width = 15)
	@TableField(exist = false)
	private String invoiceTypeStr;

    @Excel(name = "银行渠道", width = 15)
    @ApiModelProperty(value = "银行渠道")
    private String payChannel;

	/**设备id*/
	@Excel(name = "设备id", width = 15)
	@ApiModelProperty(value = "设备id")
	private String meterId;
	/**支付金额(实收)*/
	@Excel(name = "支付金额(实收)", width = 15)
	@ApiModelProperty(value = "支付金额(实收)")
	private String payAmount;

	/**支付模式 alipay:支付宝,weixinpay:微信,offline:线下*/
	@ApiModelProperty(value = "支付模式 alipay:支付宝,weixinpay:微信,offline:线下")
	@Dict(dicCode = "pay_mode")
	private String payMode;

	@Excel(name = "支付模式", width = 15)
	@TableField(exist = false)
	private String payModeStr;
	@TableField(exist = false)
	private String payQRCode;

	@Excel(name = "支付方式", width = 15)
	@ApiModelProperty(value = "支付方式")
	private String payType;
	@ApiModelProperty(value = "支付状态(0:支付中 1:支付成功 9:支付失败或用户取消 )")
	private Integer payStatus;

	@TableField(exist = false)
	@Excel(name = "支付状态", width = 15)
	private String payStatusStr;

	/**支付时间*/
	@Excel(name = "支付时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "支付时间")
	private Date payTime;
	/**缴费人姓名*/
	@Excel(name = "缴费人姓名", width = 15)
	@ApiModelProperty(value = "缴费人姓名")
	private String payUser;
	/**projectId*/
	@Excel(name = "projectId", width = 15)
	@ApiModelProperty(value = "projectId")
	private String projectId;
	/**退款者*/
	@Excel(name = "退款者", width = 15)
	@ApiModelProperty(value = "退款者")
	private String refundBy;
	@ApiModelProperty(value = "退款状态0:未退款 1:已退款")
	private Integer refundStatus;

	@Excel(name = "退款状态", width = 15)
	@TableField(exist = false)
	private String refundStatusStr;

	/**退款日期*/
	@Excel(name = "退款日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "退款日期")
	private Date refundTime;
	/**备注*/
	@Excel(name = "备注", width = 15)
	@ApiModelProperty(value = "备注")
	private String remarks;
	/**参数化请求内容*/
	@Excel(name = "参数化请求内容", width = 15)
	@ApiModelProperty(value = "参数化请求内容")
	private String request;
	/**支付接口响应内容*/
	@Excel(name = "支付接口响应内容", width = 15)
	@ApiModelProperty(value = "支付接口响应内容")
	private String response;
	/**订单号(yyyyMMddHHmmss+M+4位流水号)*/
	@Excel(name = "订单号(yyyyMMddHHmmss+M+4位流水号)", width = 15)
	@ApiModelProperty(value = "订单号(yyyyMMddHHmmss+M+4位流水号)")
	private String sn;
	@TableField(exist = false)
	private String floorId;
	@TableField(exist = false)
	private String roomId;
	/**税额*/
	/*@Excel(name = "税额", width = 15)
	@ApiModelProperty(value = "税额")
	private String taxAmount;*/
	/**租户id*/
	@Excel(name = "租户id", width = 15)
	@ApiModelProperty(value = "租户id")
	private String tenantId;
	/**更新者*/
	@Excel(name = "更新者", width = 15)
	@ApiModelProperty(value = "更新者")
	private String updateBy;
	/**更新时间*/
	@Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "更新时间")
	private Date updateTime;
	/**删除标志*/
	@Excel(name = "删除标志", width = 15)
	@ApiModelProperty(value = "删除标志")
	private String delFlag;

	@TableField(exist = false)
	private String projectName;
	@TableField(exist = false)
	private String meterCode;
	@TableField(exist = false)
	private String meterName;
	@TableField(exist = false)
	@Dict(dicCode ="meter_type")
	private String meterType;
	@TableField(exist = false)
	private String fromDate;
	@TableField(exist = false)
	private String toDate;
	@TableField(exist = false)
	private String earning;
	@TableField(exist = false)
	private String createName;
	@TableField(exist = false)
	private String refundName;
	// 管理处的地址
	@TableField(exist = false)
	private String officeAddress;
	// 管理处的电话
	@TableField(exist = false)
	private String officePhone;
	@TableField(exist = false)
	private List<MeterOrderInvoice> orderInvoiceList;
    @TableField(exist = false)
	private String payAmountStr;
	@ApiModelProperty(value = "可通断集合")
	@TableField(exist = false)
	private List<MeterSwitchRespVo> switchRespVoList;

	@TableField(exist = false)
	private String transNo;

    @TableField(exist = false)
	private String timeStr;
    //电表名称
    @TableField(exist = false)
	private String name;
    @TableField(exist = false)
	private String address;
    /** 发票号码*/
    @TableField(exist = false)
    private String fphm;

	/**房间 楼宇信息*/
	@TableField(exist = false)
    private String floorName;
	@TableField(exist = false)
    private String roomName;
	public String getRefundStatusStr() {
		return RefundStatusEnum.getDesc(this.getRefundStatus());
	}

	public String getPayModeStr() {
		return PayModeEnum.getDesc(this.getPayMode());
	}

	public String getPayTypeStr(){
		return PayTypeEnum.getDesc(Integer.valueOf(this.getPayType()));
	}

	public String getPayStatusStr() {
		return PayStatusEnum.getDesc(this.getPayStatus());
	}

	public String getChargeStatusStr() {
		return ChargeStatusEnum.getDesc(this.getChargeStatus());
	}

	public String getInvoiceStatusStr() {
		return MeterInvoiceStatusEnum.getDesc(this.getInvoiceStatus());
	}

	public String getInvoiceTypeStr() {
		return InvoiceTypeEnum.getDesc(this.getInvoiceType());
	}
}
